<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
	xmlns:a="http://richfaces.org/a4j"
    template="/layout/template.xhtml">

<ui:define name="body">

		<h:form id="registerForm">
		<rich:panel>
            <f:facet name="header">Register</f:facet>
            
            <s:decorate id="loginField" template="/layout/edit.xhtml">
                <ui:define name="label">Login</ui:define>
                <h:inputText id="login"
                       required="true"
                           size="45"
                      maxlength="45"
                          value="#{user.login}">
             		<a:support event="onblur" reRender="loginField" bypassUpdates="true" ajaxSingle="true"/>
             	</h:inputText>             	
            </s:decorate>
           
            <s:decorate id="passwordField" template="/layout/edit.xhtml">
                <ui:define name="label">Password</ui:define>
                <h:inputSecret id="password"
                       required="true"
                           size="45"
                      maxlength="45"
                          value="#{user.password}">
                    <!-- 
                    <a:support event="onblur" reRender="passwordField" bypassUpdates="true" ajaxSingle="true"/>
                     -->
                </h:inputSecret>
            </s:decorate>
            
            <s:decorate id="nameField" template="/layout/edit.xhtml">
                <ui:define name="label">Name</ui:define>
                <h:inputText id="name"
                       required="true"
                           size="45"
                      maxlength="45"
                          value="#{user.name}">
                    <a:support event="onblur" reRender="nameField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>
            
            
            <s:decorate id="surnameField" template="/layout/edit.xhtml">
                <ui:define name="label">Surname</ui:define>
                <h:inputText id="surname"
                       required="true"
                           size="45"
                      maxlength="45"
                          value="#{user.surname}">
                    <a:support event="onblur" reRender="surnameField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="birthDateField" template="/layout/edit.xhtml">
                <ui:define name="label">Birth date</ui:define>
                <rich:calendar id="birthDate"
                       required="true"
                          value="#{user.birthDate}" datePattern="MM/dd/yyyy" />
            </s:decorate>


            <s:decorate id="createDateField" template="/layout/edit.xhtml">
                <ui:define name="label">Create date</ui:define>
                <rich:calendar id="createDate"
                       required="true"
                          value="#{user.createDate}" datePattern="MM/dd/yyyy" />
            </s:decorate>


            <s:decorate id="modifyDateField" template="/layout/edit.xhtml">
                <ui:define name="label">Modify date</ui:define>
                <rich:calendar id="modifyDate"
                          value="#{user.modifyDate}" datePattern="MM/dd/yyyy" />
            </s:decorate>


            <s:decorate id="deleteDateField" template="/layout/edit.xhtml">
                <ui:define name="label">Delete date</ui:define>
                <rich:calendar id="deleteDate"
                          value="#{user.deleteDate}" datePattern="MM/dd/yyyy" />
            </s:decorate>


            <s:decorate id="typeField" template="/layout/edit.xhtml">
                <ui:define name="label">Type</ui:define>
                <h:inputText id="type"
                       required="true"
                           size="10"
                      maxlength="10"
                          value="#{user.type}">
                    <a:support event="onblur" reRender="typeField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="calculatedRateField" template="/layout/edit.xhtml">
                <ui:define name="label">Calculated rate</ui:define>
                <h:inputText id="calculatedRate"
                       required="true"
                          value="#{user.calculatedRate}">
                    <a:support event="onblur" reRender="calculatedRateField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="enabledField" template="/layout/edit.xhtml">
                <ui:define name="label">Enabled</ui:define>
                <h:selectBooleanCheckbox id="enabled"
                                   required="true"
                                      value="#{user.enabled}"/>
            </s:decorate>
            
           
            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>
            
            
        <h:graphicImage value="/seam/resource/captcha"/>
        <h:inputText id="captchaInput" value="#{captcha.response}" required="true">
			<s:validate />
		</h:inputText>
        <h:message for="captchaInput"/>
            
        </rich:panel>
        
        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{registerBean.createAction}"/>

            <s:button id="cancel"
                   value="Cancel"
             propagation="end"
                    view="/home.xhtml"
                rendered="#{userHome.managed}"/>

        </div>
		
		</h:form>

</ui:define>
</ui:composition>
